# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=knotes
pkgver=22.04.3
pkgrel=0
# armhf blocked by extra-cmake-modules
# ppc64le and s390x blocked by kdepim-runtime
# riscv64 disabled due to missing rust in recursive dependency
arch="all !armhf !ppc64le !s390x !riscv64"
url="https://kontact.kde.org/"
pkgdesc="Popup notes"
license="GPL-2.0-or-later AND LGPL-2.0-or-later AND GFDL-1.2-only"
depends="kdepim-runtime"
makedepends="extra-cmake-modules qt5-qtbase-dev qt5-qtx11extras-dev grantlee-dev kcompletion-dev kconfig-dev kconfigwidgets-dev kcoreaddons-dev kcrash-dev kdbusaddons-dev kdnssd-dev kdoctools-dev kglobalaccel-dev kiconthemes-dev kitemmodels-dev kitemviews-dev kcmutils-dev knewstuff-dev knotifications-dev knotifyconfig-dev kparts-dev ktextwidgets-dev kwidgetsaddons-dev kwindowsystem-dev kxmlgui-dev knotifications-dev akonadi-dev akonadi-notes-dev kcalutils-dev kontactinterface-dev libkdepim-dev kmime-dev pimcommon-dev kpimtextedit-dev grantleetheme-dev akonadi-search-dev libxslt-dev samurai"
checkdepends="xvfb-run"
source="https://download.kde.org/stable/release-service/$pkgver/src/knotes-$pkgver.tar.xz"
subpackages="$pkgname-doc $pkgname-lang"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	cd build

	# knotesgrantleeprinttest is broken
	CTEST_OUTPUT_ON_FAILURE=TRUE xvfb-run ctest -E "knotesgrantleeprinttest"
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}

sha512sums="
13d6bc3a2a03ee2710e793e1f75a412db8a302095269323dcfab69c7c741de09bcc78d5d33af034b228d04166ed1ad072029914725180818bf2044d9d2ed5dea  knotes-22.04.3.tar.xz
"
